<?php
    Yii::app()->clientScript->registerScriptFile('https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.15/jquery-ui.min.js');
    Yii::app()->clientScript->registerCssFile('css/jquery-ui-1.8.14.custom.css');
    Yii::app()->clientScript->registerCssFile('css/stock/grid/fip-style.css');
    Yii::app()->clientScript->registerCssFile('css/stock/importFromWeb.css');
?>

<!--Date picker-->
<script>
    $(function(){
        $( "#from" ).datepicker({
            numberOfMonths: 1,
            showButtonPanel: true,
            dateFormat: 'dd/mm/yy',
            changeMonth: true,
            changeYear: true,
            yearRange: '-10:+0',
            maxDate: 0
        });

        $( "#to" ).datepicker({
            numberOfMonths: 1,
            showButtonPanel: true,
            dateFormat: 'dd/mm/yy',
            changeMonth: true,
            changeYear: true,
            yearRange: '-10:+0',
            maxDate: 0
        });
    });
</script>


<div class="form">
    <form>
        <div id="FPTInputs">
            House
            <select id="house" name="house" class="house">
                <option value="1">HOSE</option>
                <option value="2">HNX</option>
            </select>
            &nbsp;&nbsp;
            
            
            Stock
            
            <select id="stock_id" name="stock_id" class="stock_id">

            
            <?PHP
            
            $accTypeList = Company::model()->findAll(array('order'=>'ticket')); // get all account type from table AccountType
            $arrAcc = array();    // array store users
            foreach ($accTypeList as $acc) {
                if($acc->ticket!="VNINDEX"&&$acc->ticket!="HNX") echo "<option value=\"".$acc->ticket."\">".$acc->ticket."</option>";     // id => nameType ==== ex: '1' => 'admin'
            }
            ?>
             </select>
         <!--   <select id="stock_id" name="stock_id" class="stock_id">
                <option value="">All</option>
            </select>
           --> <br/>
            &nbsp;
            From
            <?php echo CHtml::textfield(
                'from'
            ); ?>
            &nbsp;&nbsp;
            to
            <?php echo CHtml::textfield(
                'to'
            ); ?>&nbsp;&nbsp;Step:<INPUT value="1" Name="step" SIZE=3>
        </div><!--FPTInputs-->
        <div style="clear:both">&nbsp;</div>

        <div id="submission">
        <?php
        echo CHtml::ajaxSubmitButton(
            'Calculate',
            array('ajax/CLR'),
            array(
                'class' => 'submitButton',
                'update' => '#result',

                'error' => 'js:function(){
                    alert(\'Error\');
                }',

                'beforeSend' => 'js:function(){
                    var status = document.getElementById(\'status\');
                    status.innerHTML = "Calculating...";
                }',

                'complete' => 'js:function(){
                    var status = document.getElementById(\'status\');
                    status.innerHTML = "Done";
                }'
            )
        );
        ?>
        </div><!--submission-->

        <div id="status">&nbsp;</div>

        <div id="result">&nbsp;</div>
    </form>
</div><!-- form -->